package com.ltkj.ticket.service.impl;

import com.ltkj.common.core.utils.DateUtils;
import com.ltkj.common.security.utils.SecurityUtils;
import com.ltkj.ticket.domain.TicVenuesPeriod;
import com.ltkj.ticket.mapper.TicVenuesPeriodMapper;
import com.ltkj.ticket.service.ITicVenuesPeriodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 方案时间段Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-08-30
 */
@Service
public class TicVenuesPeriodServiceImpl implements ITicVenuesPeriodService 
{
    @Autowired
    private TicVenuesPeriodMapper ticVenuesPeriodMapper;


    /**
     * 查询方案时间段
     * 
     * @param periodId 方案时间段主键
     * @return 方案时间段
     */
    @Override
    public TicVenuesPeriod selectTicVenuesPeriodByPeriodId(Long periodId)
    {
        return ticVenuesPeriodMapper.selectTicVenuesPeriodByPeriodId(periodId);
    }

    /**
     * 查询方案时间段列表
     * 
     * @param ticVenuesPeriod 方案时间段
     * @return 方案时间段
     */
    @Override
    public List<TicVenuesPeriod> selectTicVenuesPeriodList(TicVenuesPeriod ticVenuesPeriod)
    {
        ticVenuesPeriod.setIsDel("0");
        return ticVenuesPeriodMapper.selectTicVenuesPeriodList(ticVenuesPeriod);
    }

    /**
     * 新增方案时间段
     * 
     * @param ticVenuesPeriod 方案时间段
     * @return 结果
     */
    @Override
    public int insertTicVenuesPeriod(TicVenuesPeriod ticVenuesPeriod)
    {
        ticVenuesPeriod.setCreateTime(DateUtils.getNowDate());
        ticVenuesPeriod.setIsDel("0");
        String username = SecurityUtils.getUsername();
        ticVenuesPeriod.setCreateBy(username);
        return ticVenuesPeriodMapper.insertTicVenuesPeriod(ticVenuesPeriod);
    }

    /**
     * 修改方案时间段
     * 
     * @param ticVenuesPeriod 方案时间段
     * @return 结果
     */
    @Override
    public int updateTicVenuesPeriod(TicVenuesPeriod ticVenuesPeriod)
    {
        ticVenuesPeriod.setUpdateTime(DateUtils.getNowDate());
        String username = SecurityUtils.getUsername();
        ticVenuesPeriod.setUpdateBy(username);
        return ticVenuesPeriodMapper.updateTicVenuesPeriod(ticVenuesPeriod);
    }

    /**
     * 批量删除方案时间段
     * 
     * @param periodIds 需要删除的方案时间段主键
     * @return 结果
     */
    @Override
    public int deleteTicVenuesPeriodByPeriodIds(Long[] periodIds)
    {

        return ticVenuesPeriodMapper.deleteTicVenuesPeriodByPeriodIds(periodIds);
    }

    /**
     * 删除方案时间段信息
     * 
     * @param periodId 方案时间段主键
     * @return 结果
     */
    @Override
    public int deleteTicVenuesPeriodByPeriodId(Long periodId)
    {
        return ticVenuesPeriodMapper.deleteTicVenuesPeriodByPeriodId(periodId);
    }
}
